Page({


  /**
   * 页面的初始数据
   */
  data: {
      statusHeight:'',
      navHeight:'',
      titleText:"有间宠物小店",
      background:"rgba(252, 147, 177 ,1)",
      value:"",
      //轮播图片地址
      swiper_img:[
          'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=438093158,1803923821&fm=26&gp=0.jpg',
          'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=438093158,1803923821&fm=26&gp=0.jpg',
          'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=438093158,1803923821&fm=26&gp=0.jpg'
      ],
      shop_list:[
          {
              img:'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name:'张姐的宠物店',
              count:12
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '老刘的宠物店',
              count: 22
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '老刘的宠物店',
              count: 22
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '老刘的宠物店',
              count: 22
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '老刘的宠物店',
              count: 22
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '老刘的宠物店',
              count: 22
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '老刘的宠物店',
              count: 22
          }
      ],

    //   满减: fullReduction, 距离: distance, 时间: timeL, 名称: name, img:图片地址,优惠卷金额:money,类型:type,星星:xxValue
      shop_data:[
          {
                img:'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
                name:'张三',
                timeL:'60',
                distance:'0.7km',
                fullReduction:'200',
                money:'50',
                overdueTime:'11月11日',
                xxValue:0.5,
                // 0:普通 1新人 2热销  
                state:'1',
                // 0:宠物 1:叉子 2:饮料 3麦克风
                type:'0'
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '里斯宠物',
              timeL: '60',
              distance: '0.7km',
              fullReduction: '200',
              money: '50',
              overdueTime: '11月11日',
              xxValue: 5,
              // 0:普通 1新人 2热销  
              state: '2',
              // 0:宠物 1:叉子 2:饮料 3麦克风
              type: '0'
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '牛肉面',
              timeL: '60',
              distance: '0.7km',
              fullReduction: '200',
              money: '50',
              overdueTime: '11月11日',
              xxValue: 1,
              // 0:普通 1新人 2热销  
              state: '0',
              // 0:宠物 1:叉子 2:饮料 3麦克风
              type: '3'
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '驴子宠物',
              timeL: '60',
              distance: '0.7km',
              fullReduction: '200',
              money: '50',
              overdueTime: '11月11日',
              xxValue: 2.5,
              // 0:普通 1新人 2热销  
              state: '0',
              // 0:宠物 1:叉子 2:饮料 3麦克风
              type: '1'
          },
          {
              img: 'http://img3.cache.netease.com/catchimg/20100926/89S0M189_0.jpg',
              name: '驴子宠物',
              timeL: '60',
              distance: '0.7km',
              fullReduction: '200',
              money: '50',
              overdueTime: '11月11日',
              xxValue: 3,
              // 0:普通 1新人 2热销  
              state: '1',
              // 0:宠物 1:叉子 2:饮料 3麦克风
              type: '3'
          }
      ],
      actic:'',
      select:'',
      actic_show:false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
      let statusHeight = getApp().globalData.statusHeight
      let navHeight = getApp().globalData.navHeight
      if (statusHeight == 20){
          statusHeight = 32
      }
        this.setData({
            statusHeight: statusHeight,
            navHeight: navHeight
        })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  },
    // 获取搜索框值
    onSearch:function(value){
        wx.navigateTo({
            url: `../search/search?value=${value.detail}`
        })
    },
    // 推荐店铺筛选
    select:function(index){
        let that = this
        console.log(that.data.actic)
        that.setData({
            actic: index.currentTarget.dataset.index,
        })

        if (that.data.actic == '0'){
            that.setData({
                actic_show: true
            })
        }else{

            that.setData({
                select: '',
                actic_show: false
            })
        }

    },
    selects: function (index){
        let that = this
        that.setData({
            select: index.currentTarget.dataset.index,
            actic_show:false
        })
    },
    // 滑动到地步触发分页瀑布流
    scrollnoUse:function(){
        console.log("滑动到地步触发分页瀑布流")
    },
    //店铺分享
    shareShop:function(index){
        wx.navigateTo({
            url: `../share/share?id=${index.currentTarget.dataset.index}`
        })
    },
    // 领优惠卷
    Receive:function(index){
        wx.navigateTo({
            url: `../Receive/Receive?id=${index.currentTarget.dataset.index}`
        })
    },
    goMap:function(){
        wx.navigateTo({
            url: `../Map/Map`
        })
    }

})